package com.yyjj.zixun.adapter;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yyjj.zixun.R;
import com.yyjj.zixun.activity.ZiXunDetailsActivity;
import com.yyjj.zixun.entity.NewsListEntity;

import tech.com.commoncore.manager.GlideManager;
import tech.com.commoncore.utils.FastUtil;
import tech.com.commoncore.utils.OnNoDoubleClickListener;

public class ZiXunListAdapter extends BaseQuickAdapter<NewsListEntity, BaseViewHolder> {


    public ZiXunListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final NewsListEntity item) {

        ImageView iv = (ImageView) helper.getView(R.id.img);
        GlideManager.loadImg(item.getLogo(), iv, R.mipmap.ic_launcher);
//
        helper.setText(R.id.tv_title, item.getTitle());
        helper.itemView.setOnClickListener(new OnNoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                Bundle bundle = new Bundle();
                bundle.putSerializable("url",item.getUrl());
                FastUtil.startActivity(mContext,ZiXunDetailsActivity.class,bundle);
            }
        });

    }
}
